//
//  WYWModelToolTest.m
//  SQlite
//
//  Created by Mr.Run on 2017/11/14.
//  Copyright © 2017年 Mr.Run. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "WYWModelTool.h"
#import "WYWStu.h"
#import "WYWSqliteModelTool.h"

@interface WYWModelToolTest : XCTestCase

@end

@implementation WYWModelToolTest

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testIvarNameType {
    NSString *dic = [WYWModelTool columnNamesAndTypesStr:[WYWStu class]];
    NSLog(@"%s~~~%d~~~%@",__func__,__LINE__,dic);
}

- (void)testSaveModel {
    
    WYWStu *stu = [[WYWStu alloc]init];
    stu.name = @"wu1";
    stu.stuNum = 232;
    stu.score = 502;
    stu.age = 182;
    stu.arr = @[@"a", @"d"];
    stu.dic = @{
                @"1":@"s",
                @"1":@"s"
    };
    
    [WYWSqliteModelTool saveOrUpdateModel:stu uid:nil];
    
}

- (void)testDeleteModel {
    
    WYWStu *stu = [[WYWStu alloc]init];
    stu.name = @"wu1";
    stu.stuNum = 23;
    stu.score = 502;
    stu.age = 182;
    
    [WYWSqliteModelTool deleteModel:stu uid:nil];
    
}

- (void)testDeleteModelWhere {
    
//    WYWStu *stu = [[WYWStu alloc]init];
//    stu.name = @"wu1";
//    stu.stuNum = 23;
//    stu.score = 502;
//    stu.age = 182;
    
    [WYWSqliteModelTool deleteModel:[WYWStu class] whereStr:@"score <= 44" uid:nil];
    
}

- (void)testDeleteModelWhere2 {
    
    //    WYWStu *stu = [[WYWStu alloc]init];
    //    stu.name = @"wu1";
    //    stu.stuNum = 23;
    //    stu.score = 502;
    //    stu.age = 182;
    
    [WYWSqliteModelTool deleteModel:[WYWStu class] columnName:@"age" relation:ColumnNameToValueRelationTypeEqual value:@"3" uid:nil];
    
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end
